package com.im.service.jim.processor;

import com.im.service.jim.ChatSessionUtil;
import org.jim.core.ImChannelContext;
import org.jim.core.ImPacket;
import org.jim.core.packets.Command;
import org.jim.server.command.AbstractCmdHandler;

/**
 * @author liuzhiqiang
 */
public class UnbindSessionProcessor extends AbstractCmdHandler {
    @Override
    public Command command() {
        return Command.UNBIND_SESSION;
    }

    @Override
    public ImPacket handler(ImPacket imPacket, ImChannelContext imChannelContext) {
        imChannelContext.remove("chatId");

        String userId = imChannelContext.getUserId();
        ChatSessionUtil.sendNewSessionToUser(userId);
        return null;
    }
}
